<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
    <meta content=always name=referrer>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/newbase.css">
    <script src="__STATIC__/js/jquery-1.8.2.js"></script>
    <title>明细</title>
</head>
{include file="public/href" /}
<body>
<div class="wrap-mx">
    <div class="header">
        <p>明细</p>
        <img src="__STATIC__/img/back.png" class="back" onclick=window.location.href="{:url('mobile/user_info/my_wallet')}">
    </div>
    <ul class="list">
        <li {eq name=":input('type',0)" value="0"}class="cur"{/eq}><span><a href="?type=0">全部</a></span></li>
        <li {eq name=":input('type',0)" value="1"}class="cur"{/eq}><span><a href="?type=1">充值</a></span></li>
        <li {eq name=":input('type',0)" value="2"}class="cur"{/eq}><span><a href="?type=2">提现</a></span></li>
        <li {eq name=":input('type',0)" value="3"}class="cur"{/eq}><span><a href="?type=3">消费</a></span></li>
    </ul>
    <input type="hidden" id="type" value="{:input('type',0)}" />
    <div class="content">
        <div class="cur" id="main">
        </div>
    </div>
</div>
{include file="public/src" /}
<script>
    //layer流加载
    layui.use('flow', function() {
        var $ = layui.jquery;
        var flow = layui.flow;
        flow.load({
            elem: '#main' //流加载容器
            ,isAuto:true
            ,isLazyimg:true
            ,done: function(page, next){ //执行下一页的回调
                var lis = [];
                var type = $('#type').val();
                $.ajax({
                    url:"{:url('mobile/user_info/wallet_details')}",
                    dataType:'json',
                    type:'post',
                    data:{'page':page,'type':type},
                    success:function(t){
                        layui.each(t.data, function(index, item){
                            var type = '';
                            var show = '';
                            var tag = '-';
                            if (item.type_id == 1){
                                type = '充值';
                                show = "__STATIC__/img_user/yellow.png";
                                tag = '+';
                            }else if (item.type_id == 2){
                                type = '佣金提现到余额';
                                show = "__STATIC__/img_user/blue.png";
                                tag = '+';
                            }else if (item.type_id == 3){
                                type = '消费';
                                show = "__STATIC__/img_user/pink.png";
                            }else if (item.type_id == 4) {
                                type = '保证金充值';
                                show = "__STATIC__/img_user/pink.png";
                            }else if(item.type_id == 5) {
                                type = '退款';
                                show = "__STATIC__/img_user/yellow.png";
                                tag = '+';
                            }
                            lis.push('<div class="main"><img src="'+show+'">' +
                                    '<div class="left">'+type+'：<br><span class="small">余额：'+item.balance+'</span></div>' +
                                    '<div class="right"><span>'+tag+item.price+'</span><br>' +
                                    '<span class="small">'+item.create_time+'</span></div></div>');
                        });
                        next(lis.join(''), page < t.pages);
                    },
                    error: function () {
                        layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
                    }
                })
            }
        });
    });
</script>
</body>
</html>